<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset=utf-8>
    <meta name="viewport"
          content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=0">
    <title>Title</title>
</head>
<style>
    *{
        margin: 0;
        padding: 0;
        list-style: none;
    }

    nav{
        width: 100%;
        height: 100px;
        display: flex;
        position: fixed;
        top: 0;
        border-bottom: 1px solid #222222;
        justify-content: space-between;
    }

    nav p{
        display: block;
        width: 33%;
        height: 100%;
        border-right: 1px solid #222222;
        text-align: center;
        line-height: 100px;
    }

    li{
        width: 100%;
        height: 600px;
    }
</style>
<body>
    <nav>
        <p style="background: #ff9800">1</p>
        <p>2</p>
        <p>3</p>
    </nav>

    <ul>
        <li>1.1</li>
        <li>2.2</li>
        <li>3.3</li>
    </ul>

</body>
</html>
<script>
    let liEl = document.querySelectorAll('li')
    let pEl = document.querySelectorAll('p')
    let ps = Array.prototype.slice.call(pEl)

    window.onscroll = function (e) {
      const scrollTop = document.documentElement.scrollTop + 100;
      Array.prototype.slice.call(liEl).map( (El, i) => {
        if(scrollTop  >= El.offsetTop && scrollTop <= El.offsetHeight  + El.offsetTop){
          pEl[i].style.background = '#ff9800';

          ps.map( (e, index) => {
            if(index !== i){
              pEl[index].style.background = '#fff'
            }
          })
        }
      })

    document.querySelector('nav').onclick = function (e) {
      let liI = contains(ps, e.target);
      let liOffsetTop = liEl[liI].offsetTop;
      document.documentElement.scrollTop = liOffsetTop

    }

    function contains(arrays, obj) {
      let i = arrays.length;
      while (i--) {
        if (arrays[i] === obj) {
          return i;
        }
      }
      return false;
    }

</script>